<?php

class User_model extends MY_Model {

    function __construct() {
        parent::__construct();
        $this->table = 'user';
    }

    function checkLogin( $username, $password ) {
        $this->db->where( 'username', $username );
        $this->db->where( 'password', $password );
        $query = $this->db->get( $this->table );

        $result = $query->result();
        return count( $result ) > 0 ? $result[0] : NULL;
    }
    function loginWithFace($faceId){
    	$this->db->select('user.id');
    	$this->db->where('user.facebookid', $faceId);
    	$query = $this->db->get($this->table);
    	return $query->result();
    }
}

?>
